package backend.Instruction;

import backend.component.RISCVfunction;

public class RISCVcall extends RISCVinst {
    private String funcname;
    private RISCVfunction tarFunction;

    public RISCVcall(RISCVfunction function) {
        this.tarFunction = function;
        this.funcname = function.getName();
    }

    public RISCVfunction tarFunction() {
        return tarFunction;
    }

    public void setTarFunction(RISCVfunction tarFunction) {
        this.tarFunction = tarFunction;
    }

    public String funcname() {
        return funcname;
    }

    public void setFuncname(String funcname) {
        this.funcname = funcname;
    }

    public RISCVfunction getTarFunction() {
        return tarFunction;
    }

    public RISCVcall(String funcname) {
        this.funcname = funcname;
    }

    @Override
    public String toString() {
        return "jal " + (funcname.startsWith("@")?funcname.substring(1):funcname) + "\n";
    }
}
